<?php
$page = Yii::app()->getRequest()->getParam('Project_page') ? Yii::app()->getRequest()->getParam('Project_page') : 1;$this->breadcrumbs=array(
    Yii::t('site','Projects')=>array('admin','Project_page'=>$page),
    $model->recordName,
    Yii::t('site','View'),
);

$this->menu=array(
    array('label'=>Yii::t('site','Item'),'items'=>array(
        array('label'=>Yii::t('site','Update Project'), 'url'=>array('update', 'id'=>$model->id,'Project_page'=>$page)),
        array('label'=>Yii::t('site','Delete Project'), 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->id,'Project_page'=>$page),'confirm'=>'Are you sure you want to delete this item?')),
    )),
    array('label'=>Yii::t('site','Reports'),'items'=>array(
        array('label'=>Yii::t('site','Milestones/Priorities'), 'url'=>array('crosstab', 'type'=>'milestones/priorities','projectId'=>$model->id)),
        array('label'=>Yii::t('site','Owners/Milestones'), 'url'=>array('crosstab', 'type'=>'owners/milestones','projectId'=>$model->id)),
    )),
    array('label'=>Yii::t('site','All Items'),'items'=>array(
        array('label'=>Yii::t('site','Create New Project'), 'url'=>array('create','Project_page'=>$page)),
        array('label'=>Yii::t('site','Manage Projects'), 'url'=>array('admin','Project_page'=>$page)),
    )),
);
?>

<h1><?php echo Yii::t('site','View Project <em>{recordName}</em>',array('{recordName}'=>$model->recordName)); ?></h1>

<?php $this->widget('zii.widgets.CDetailView', array(
    'data'=>$model,
    'attributes'=>array(
        'id',
        'name',
        'description',
        array(
            'label'=>Yii::t('site','Milestones'),
            'type'=>'raw',
            'value'=>CHtml::link(count($model->milestones),array('/milestone/admin','Milestone[projectId]'=>$model->id)),
        ),
        array(
            'label'=>Yii::t('site','Issues'),
            'type'=>'raw',
            'value'=>CHtml::link(count($model->issues),array('/issue/admin','Issue[projectId]'=>$model->id)),
        ),
        array(
            'name'=>'isPublic',
            'type'=>'raw',
        ),
        array(
            'name'=>'tsCreated',
            'type'=>'raw',
            'value'=>Yii::app()->dateFormatter->formatDateTime($model->tsCreated,'medium','short'),
        ),
        array(
            'name'=>'userIdCreated',
            'type'=>'raw',
            'value'=>$model->createdBy->recordName
        ),
        array(
            'name'=>'tsUpdated',
            'type'=>'raw',
            'value'=>$model->tsUpdated!=null ? Yii::app()->dateFormatter->formatDateTime($model->tsUpdated,'medium','short') : '-',
            'visible' => !is_null($model->tsUpdated),
        ),
        array(
            'name'=>'userIdUpdated',
            'type'=>'raw',
            'value'=>$model->updatedBy->recordName,
            'visible' => !is_null($model->userIdUpdated),
        ),
    ),
)); ?>

<br/><br/>
<h3>Project Members</h3>
<?php $this->widget('zii.widgets.grid.CGridView', array(
    'dataProvider'=>$model->membersDataProvider,
    'template'=>'{summary}{items}',
    'columns'=>array(
        array(
            'name'=>'fullname',
            'header' => Yii::t('site','Name'),
        ),
        array(
            'name'=>'email',
            'header'=> Yii::t('site','Email'),
            'type'=>'raw',
            'value'=>'CHtml::mailto($data[\'email\'])',
        ),
        array(
            'class'=>'CButtonColumn',
            'template'=>'{delete}',
            'buttons'=>array(
                'delete'=>array(
                    'url'=>'Yii::app()->createUrl("/project/deleteMember", array("projectId"=>$data[\'projectId\'],"userId"=>$data[\'memberId\'],"email"=>$data[\'email\']))',
                    'visible'=>'Yii::app()->user->id==$data[\'ownerId\']',
                ),
            ),
        ),
    ),
)); ?>
